//Copyright (c) 2012 The cwkshell Authors. All rights reserved. 
// Use of this source code is governed by a BSD-style license that can be 
// found in the LICENSE file. 
#include "cuc/src/cwkshell/view//shell_browser_dialog.h" 

#include "base/auto_reset.h"
#include "base/win/wrapped_window_proc.h"
#include "content/public/browser/web_contents.h"
#include "cuc/src/cwkshell/browser/shell_browser.h" 
#include "cuc/src/cwkshell/view/shell_browser_dialog_non_client_view.h" 
#include "ui/gfx/rect.h"
#include "ui/base/win/hwnd_util.h"
namespace cuc{ 
	namespace shell{ 

		ShellBrowserDialog::ShellBrowserDialog(content::WebContents* web_contents)
			: ShellWindow(web_contents)
		{
				Init();	
				window_title_ = L"Dialog";

				ShellBrowser::instance()->OnWindowCreated(this);

		}

		ShellBrowserDialog::~ShellBrowserDialog() {

			ShellBrowser::instance()->CloseWindow(this);
		}


		ShellBrowserDialog* ShellBrowserDialog::CreateShellBrowserDialog(
			content::WebContents* web_contents, 
			const ShellWindow::Feature& feature )
		{
				LOG(INFO)<<"ShellBrowserDialog::CreateShellBrowserDialog: feature.height = "<<feature.height;
				ShellBrowserDialog* shell = new ShellBrowserDialog(web_contents);
			
					int height = ShellBrowser::property()->GetDialogInitHeight();
					int width = ShellBrowser::property()->GetDialogInitWidth();
					shell->ShowWindow(gfx::Size(width,height),false);
			
			return shell;
		}
		views::NonClientFrameView* 
			ShellBrowserDialog::CreateNonClientFrameView( views::Widget* widget ) 
		{

			ShellBrowserDilaogNonClientView* view = new ShellBrowserDilaogNonClientView;
			view->Init(widget);
			return view;
		}
		
	} //namespace shell 
} //namespace cuc 
